//
//  IPInputContentController.swift
//  IPlan
//
//  Created by robot on 3/24/16.
//  Copyright © 2016 codeFighter.com. All rights reserved.
//

import UIKit

open class IPInputContentController: UIViewController,UITextViewDelegate {

    open var iputControlTitleString: NSString = "qqwqw"
    override open func viewDidLoad() {
        super.viewDidLoad()
        view.backgroundColor = UIColor.init(netHex: 0xEAEEF1)
        assert(iputControlTitleString.length != 0, "did not set the controller's title")
        navigationItem.rightBarButtonItem = UIBarButtonItem.init(barButtonSystemItem: UIBarButtonSystemItem.done, target: self, action: #selector(IPInputContentController.doneButtonAction))
        
        title = iputControlTitleString as String
        setUpContentView()
        // Do any additional setup after loading the view.
    }
    
    lazy var inputContentTextView = UITextView()
    func setUpContentView() ->Void{
        
        inputContentTextView.frame = CGRect(x: 0, y: 0, width: SCREEN_W, height: 300)
        view.addSubview(inputContentTextView)
        inputContentTextView.font = UIFont.systemFont(ofSize: 16)
        inputContentTextView.delegate = self
        
    }
    
    open func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
        
        print("\(textView.text)")
        
        return true
    }
    open func doneButtonAction() ->Void {
    
    UserDefaults.standard.setValue(inputContentTextView.text, forKey: "jobContent")
        
    navigationController?.popViewController(animated: true)
    
    }
    override open func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

}
